package jh.com.jhappbf.utils;

import java.time.format.DateTimeFormatter;

/**
 * @author : wwh
 * e-mail  : 953889276@qq.com
 * time    : 2019/6/28 16:43
 * desc    :
 */
public class DateTimeUtils {
    private final static String COMMON_PATTERN = "yyyy-MM-dd HH:mm:ss";
//    private final static DateTimeFormatter COMMON_FORMATTER = DateTimeFormatter.ofPattern(COMMON_PATTERN);
//​
//    private final static ZoneOffset DEFAULT_ZONE_OFFSET = ZoneOffset.of("+8");
//​
//    /**
//     * 默认 yyyy-MM-dd HH:mm:ss 格式
//     */
//    public static String dateToString(LocalDateTime dateTime) {
//        assert dateTime != null;
//        return COMMON_FORMATTER.format(dateTime);
//    }
//​
//    /**
//     * 默认 yyyy-MM-dd HH:mm:ss 格式
//     */
//    public static LocalDateTime stringToDate(String dateStr) {
//        assert dateStr != null;
//        return LocalDateTime.parse(dateStr, COMMON_FORMATTER);
//    }
//​
//    public static String dateToString(LocalDateTime dateTime, DateTimeFormatter formatter) {
//        assert dateTime != null;
//        return formatter.format(dateTime);
//    }
//​
//    public static LocalDateTime stringToDate(String dateStr, DateTimeFormatter formatter) {
//        assert dateStr != null;
//        return LocalDateTime.parse(dateStr, formatter);
//    }
//​
//    public static long dateToTimeMillis(LocalDateTime dateTime) {
//        assert dateTime != null;
//        return dateTime.toInstant(DEFAULT_ZONE_OFFSET).toEpochMilli();
//    }
//​
//    public static LocalDateTime timeMillisToDate(long timeMillis) {
//        Instant instant = Instant.ofEpochMilli(timeMillis);
//        return LocalDateTime.ofInstant(instant, DEFAULT_ZONE_OFFSET);
//    }

}
